import 'package:flutter/material.dart';
import 'salary_calculator.dart';

class ButtonPage extends StatelessWidget {
  const ButtonPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('按钮页面')),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            TextButton(
              onPressed: () => Navigator.pop(context),
              child: const Text('返回首页'),
            ),
            _buildOriginalButtons(context),
          ],
        ),
      ),
    );
  }

  Widget _buildOriginalButtons(BuildContext context) {
    return Column(
      children: [
        TextButton(
          onPressed: () => Navigator.pushNamed(context, "tip_page"),
          child: const Text('打开提示页'),
        ),
        TextButton(
          onPressed: () => Navigator.pushNamed(context, "list_page"),
          child: const Text('打开列表页'),
        ),
        TextButton(
          onPressed:
              () => Navigator.push(
                context,
                MaterialPageRoute(
                  builder: (context) => const SalaryCalculatorPage(),
                ),
              ),
          child: const Text('薪资计算器'),
        ),
        ElevatedButton.icon(
          icon: const Icon(Icons.send),
          label: const Text("发送"),
          onPressed: () => print('发送按钮被点击了'),
        ),
        OutlinedButton.icon(
          icon: const Icon(Icons.add),
          label: const Text("添加"),
          onPressed: () => print('添加按钮被点击了'),
        ),
        TextButton.icon(
          icon: const Icon(Icons.info),
          label: const Text("详情"),
          onPressed: () => print('详情按钮被点击了'),
        ),
      ],
    );
  }
}
